package com.neusoft.chanceserver.controller;


import com.neusoft.chanceserver.dto.CompetitionAdd;
import com.neusoft.chanceserver.dto.RespBean;
import com.neusoft.chanceserver.entity.Competition;
import com.neusoft.chanceserver.service.ICompetitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 竞争情况表 前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/chance")
public class CompetitionController {
    @Autowired
    ICompetitionService iCompetitionService;

    @PostMapping("/searchCompetition/{chanceId}")
    RespBean searchCompetitionByChanceId(@PathVariable Integer chanceId){
        return iCompetitionService.searchCompetitionByChanceId(chanceId);
    }

    @PostMapping("/addCompetition")
    RespBean addCompetition(@RequestBody CompetitionAdd competitionAdd){
        return iCompetitionService.addCompetition(competitionAdd);
    }

    @PostMapping("/updateCompetition")
    RespBean updateCompetition(@RequestBody Competition competition){
        return iCompetitionService.updateCompetition(competition);
    }

    @PostMapping("/deleteCompetition/{competitionId}")
    RespBean deleteCompetition(@PathVariable Integer competitionId){
        return iCompetitionService.deleteCompetition(competitionId);
    }
}

